package com.jc.photo.config;

import com.aliyuncs.utils.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * AI服务配置类
 */
@Component
@ConfigurationProperties(prefix = "ai")
public class AIConfig {
    
    /**
     * 阿里云配置
     */
    private Aliyun aliyun = new Aliyun();
    
    /**
     * 字节豆包配置
     */
    private Doubao doubao = new Doubao();
    
    public static class Aliyun {
        private String accessKeySecret;
        private String endpoint = "imagerecog.cn-shanghai.aliyuncs.com";
        
        public String getAccessKeySecret() {
            if(StringUtils.isEmpty(accessKeySecret)){
                this.accessKeySecret = System.getenv("DASHSCOPE_API_KEY");
                return accessKeySecret;
            };
            return accessKeySecret;
        }
        
        public void setAccessKeySecret(String accessKeySecret) {
            this.accessKeySecret = accessKeySecret;
        }
        
        public String getEndpoint() {
            return endpoint;
        }
        
        public void setEndpoint(String endpoint) {
            this.endpoint = endpoint;
        }
    }
    
    public static class Doubao {
        private String apiKey;
        private String apiUrl = "https://ark.cn-beijing.volces.com/api/v3";
        
        // Getters and Setters
        public String getApiKey() {
            return apiKey;
        }
        
        public void setApiKey(String apiKey) {
            this.apiKey = apiKey;
        }
        
        public String getApiUrl() {
            return apiUrl;
        }
        
        public void setApiUrl(String apiUrl) {
            this.apiUrl = apiUrl;
        }
    }
    
    // Getters and Setters
    public Aliyun getAliyun() {
        return aliyun;
    }
    
    public void setAliyun(Aliyun aliyun) {
        this.aliyun = aliyun;
    }
    
    public Doubao getDoubao() {
        return doubao;
    }
    
    public void setDoubao(Doubao doubao) {
        this.doubao = doubao;
    }
}